import React, { Component } from 'react'
import PubSub from 'pubsub-js'
import Son from './Son'

export default class Far extends Component {
  render() {
    PubSub.subscribe('xxx', (topic, data) => {
      console.log('far', topic, data)
    })
    return (
      <div>
        Far{' '}
        <button
          onClick={() => {
            PubSub.publish('yyy', '嘿嘿嘿')
          }}
        >
          发布yyy话题
        </button>
        <hr />
        <Son></Son>
      </div>
    )
  }
}
